package com.example.controller;

import com.example.pojo.vo.PortalVo;
import com.example.service.HeadlineService;
import com.example.service.TypeService;
import com.example.utils.Result;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: Yun
 * @Date: 2024/3/14
 */
@RestController
@RequestMapping("/portal")
@CrossOrigin
public class PortalController {
    @Autowired
    private TypeService typeService;

    @Autowired
    private HeadlineService headlineService;

    @GetMapping("/findAllTypes")
    public Result findAllTypes() {
        Result result = typeService.findAllTypes();
        return result;
    }

    @PostMapping("/findNewsPage")
    public Result findNewsPage(@RequestBody PortalVo portalVo) {
        Result result = headlineService.findNewsPage(portalVo);
        return result;
    }

    @PostMapping("/showHeadlineDetail")
    public Result showHeadlineDetail(@Param("hid") Integer hid) {
        Result result = headlineService.showHeadlineDetail(hid);
        return result;
    }
}
